<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>v-model指令</title>
</head>
<body>


<div id="app">
    <input @click="setM" type="button" value="修该message">
    <br>
    <input @keyup.enter="getM" type="text" v-model="message">
    <br>
    <h2>{{message}}</h2>
    <br>
    足球 <input name="text" type="checkbox" v-model="hobby" v-on:click="printInfo" value="foot"/>
    篮球 <input name="text" type="checkbox" v-model="hobby" v-on:click="printInfo" value="bask"/>
</div>

<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

<script>
    new Vue({
        el: "#app",
        data: {
            message: "llhuang10",
            hobby: []
        },
        methods: {
            getM: function () {
                alert(this.message);
            },
            setM: function () {
                this.message = "酷丁鱼";
            },
            printInfo: function () {
                console.log(this.hobby);
            }
        }
    })
</script>
</body>
</html>